<HTML>
  <HEAD>
    <TITLE>threadpool Documentation</TITLE>
    <LINK HREF="threadpool.css" REL="stylesheet" TYPE="text/css">
  </HEAD>
  <BODY BGCOLOR="#FFFFFF">

    <DIV CLASS="qindex">
      <TABLE BORDER="0" WIDTH="100%">
        <TR>

          <TD ALIGN="LEFT">
            <B>threadpool</B>
          </TD>
          <TD ALIGN="RIGHT">
            <A CLASS="qindex" HREF="../index.html">Overview</A> |
            <A CLASS="qindex" HREF="../reference/annotated.html">Reference</A> |
            <A CLASS="qindex" HREF="../tutorial/intro.html">Tutorial</A> |
            <A CLASS="qindex" HREF="../examples/intro.html">Examples</A> |
            <A CLASS="qindex" HREF="../design/intro.html">Design</A>
          </TD>

        </TR>
      </TABLE>
    </DIV>
    <DIV CLASS="qindex">
      <TABLE BORDER="0" WIDTH="100%">
        <TR>
          <TD ALIGN="LEFT">
            <B>Reference</B>
          </TD>
          <TD ALIGN="RIGHT">
            <A CLASS="qindex" HREF="annotated.html">Class List</A> |
            <A CLASS="qindex" HREF="functions.html">Member Functions</A> |
            <A CLASS="qindex" HREF="namespacemembers.html">Typedefs</A> |
            <A CLASS="qindex" HREF="files.html">File List</A>
          </TD>
        </TR>
      </TABLE>
    </DIV>
<!-- Generated by Doxygen 1.4.6-NO -->
<h1>threadpool/shutdown_policies.hpp</h1><a href="a00032.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00019"></a>00019 <span class="preprocessor">#ifndef THREADPOOL_SHUTDOWN_POLICIES_HPP_INCLUDED</span>
<a name="l00020"></a>00020 <span class="preprocessor"></span><span class="preprocessor">#define THREADPOOL_SHUTDOWN_POLICIES_HPP_INCLUDED</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span>
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 
<a name="l00025"></a>00025 <span class="keyword">namespace </span>boost { <span class="keyword">namespace </span>threadpool
<a name="l00026"></a>00026 {
<a name="l00027"></a>00027 
<a name="l00028"></a>00028 
<a name="l00034"></a>00034   <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Pool&gt;
<a name="l00035"></a><a class="code" href="a00026.html">00035</a>   <span class="keyword">class </span><a class="code" href="a00026.html">wait_for_all_tasks</a>
<a name="l00036"></a>00036   {
<a name="l00037"></a>00037   <span class="keyword">public</span>:
<a name="l00038"></a><a class="code" href="a00026.html#b5b9b7558e13bf15a163d5f6a85c8a90">00038</a>     <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="a00026.html#b5b9b7558e13bf15a163d5f6a85c8a90">shutdown</a>(Pool&amp; <a class="code" href="a00024.html">pool</a>)
<a name="l00039"></a>00039     {
<a name="l00040"></a>00040       pool.wait();
<a name="l00041"></a>00041       pool.terminate_all_workers(<span class="keyword">true</span>);
<a name="l00042"></a>00042     }
<a name="l00043"></a>00043   };
<a name="l00044"></a>00044 
<a name="l00045"></a>00045 
<a name="l00051"></a>00051   <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Pool&gt;
<a name="l00052"></a><a class="code" href="a00025.html">00052</a>   <span class="keyword">class </span><a class="code" href="a00025.html">wait_for_active_tasks</a>
<a name="l00053"></a>00053   {
<a name="l00054"></a>00054   <span class="keyword">public</span>:
<a name="l00055"></a><a class="code" href="a00025.html#bd8495ef044734188ab0731ec43e8834">00055</a>     <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="a00025.html#bd8495ef044734188ab0731ec43e8834">shutdown</a>(Pool&amp; <a class="code" href="a00024.html">pool</a>)
<a name="l00056"></a>00056     {
<a name="l00057"></a>00057       pool.clear();
<a name="l00058"></a>00058       pool.wait();
<a name="l00059"></a>00059       pool.terminate_all_workers(<span class="keyword">true</span>);
<a name="l00060"></a>00060     }
<a name="l00061"></a>00061   };
<a name="l00062"></a>00062 
<a name="l00063"></a>00063 
<a name="l00070"></a>00070   <span class="keyword">template</span>&lt;<span class="keyword">typename</span> Pool&gt;
<a name="l00071"></a><a class="code" href="a00017.html">00071</a>   <span class="keyword">class </span><a class="code" href="a00017.html">immediately</a>
<a name="l00072"></a>00072   {
<a name="l00073"></a>00073   <span class="keyword">public</span>:
<a name="l00074"></a><a class="code" href="a00017.html#48146c439c47a9202a626bc658a7a553">00074</a>     <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="a00017.html#48146c439c47a9202a626bc658a7a553">shutdown</a>(Pool&amp; <a class="code" href="a00024.html">pool</a>)
<a name="l00075"></a>00075     {
<a name="l00076"></a>00076       pool.clear();
<a name="l00077"></a>00077       pool.terminate_all_workers(<span class="keyword">false</span>);
<a name="l00078"></a>00078     }
<a name="l00079"></a>00079   };
<a name="l00080"></a>00080 
<a name="l00081"></a>00081 } } <span class="comment">// namespace boost::threadpool</span>
<a name="l00082"></a>00082 
<a name="l00083"></a>00083 <span class="preprocessor">#endif // THREADPOOL_SHUTDOWN_POLICIES_HPP_INCLUDED</span>
</pre></div>    <BR>
    <DIV CLASS="qindex">
      <TABLE BORDER="0" WIDTH="100%">
        <TR>
		  <TD CLASS="tiny" ALIGN="LEFT">Copyright &copy 2005-2007 Philipp Henkel</TD>
          <TD ALIGN="RIGHT">
            <A CLASS="qindex" HREF="../index.html">Overview</A> |
            <A CLASS="qindex" HREF="../reference/annotated.html">Reference</A> |
            <A CLASS="qindex" HREF="../tutorial/intro.html">Tutorial</A> |
            <A CLASS="qindex" HREF="../examples/intro.html">Examples</A> |
            <A CLASS="qindex" HREF="../design/intro.html">Design</A>
          </TD>
        </TR>       
      </TABLE>
    </DIV>  
  </BODY>
</HTML>
